home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Sample.bin / Employee.java < prev    next >
Text File  |  1998-11-01  |  1KB  |  53 lines

  1. /**
  2.  * A completely constructed employee data object.
  3.  */
  4.  
  5. public class Employee
  6. {
  7.     public Name name;
  8.     public Section section;
  9.     public SSN ssn;
  10.  
  11.     final static int NAME_FLD = 0;
  12.     final static int AGE_FLD = 1;
  13.     final static int SSN_FLD = 2;
  14.  
  15.     public Employee(Name n, Section a, SSN s)
  16.     throws InvalidEmployeeException
  17.     {
  18.         name = n;
  19.         if (!name.isValid()) throw new InvalidEmployeeException();
  20.         section = a;
  21.         if (!section.isValid()) throw new InvalidEmployeeException();
  22.         ssn = s;
  23.         if (!ssn.isValid()) throw new InvalidEmployeeException();
  24.             //{{INIT_CONTROLS
  25.         //}}
  26. }
  27.  
  28.     public Employee(String n, String a, String s)
  29.     throws InvalidEmployeeException
  30.     {
  31.         this(new Name(n), new Section(a), new SSN(s));
  32.     }
  33.  
  34.     public String toString()
  35.     {
  36.         String s;
  37.         s = (name.value()).trim();
  38.         s += " ";
  39.         s += (String.valueOf(section.value())).trim();
  40.         s += " ";
  41.         s += (ssn.value()).trim();
  42.         s += "\r\n";
  43.         return s;
  44.     }
  45.     //{{DECLARE_CONTROLS
  46.     //}}
  47. }
  48.  
  49. /**
  50.  * A state-ful list of employee data objects.
  51.  */
  52.  
  53.